package dispatcher.person.gui.network;

import dispatcher.gui.event.PersonStatusUpdateThreadPool;
import messages.BaseMessage;
import messages.MessageType;
import messages.observer.EventCollectionMessage;
import observer.ObserverListener;
import state.Globals;

/**
 * This class is used to handle messages from the PersonDispatcher
 * @author user
 *
 */
public class PersonDispatcherGUIObserverListener implements ObserverListener {

	@Override
	public void handleMessage(BaseMessage message) {
		Globals.getLogger().log("Person Event Received", this.getClass().getName(), "handleMessage");
		if (message.getMessageType() == MessageType.EventCollectionMessage){
			
			EventCollectionMessage mess = (EventCollectionMessage)message;
			// Creates a new request thread for updating the GroupDispatcherStateHandler
			PersonStatusUpdateThreadPool.getInstance().updateStatus(mess.getEvents());
		}		
	}

}
